﻿// Book.cs
//

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ServiceModel.DomainServices;
using System.ServiceModel.DomainServices.Server;

namespace BookClub.Web.DataModel {

    [MetadataType(typeof(BookMetadata))]
    [CustomValidation(typeof(BookRules), "AddedDateFollowsPublishDate")]
    public partial class Book {

        private static class BookMetadata {

            [ExternalReference]
            public static readonly object Category = null;

            [RegularExpression("^[A-Za-z0-9]{10}$", ErrorMessage = "The ASIN must consist of uppercase letters and digits and be 10 characters long.")]
            public static readonly object ASIN = null;

            public static readonly object Title = null;

            public static readonly object Author = null;

            [CustomValidation(typeof(BookRules), "DescriptionIsMeaningful")]
            public static readonly object Description = null;
        }
    }
}
